<?php

class JSCasts_Request
{
    const METHOD_GET    = 0;
    const METHOD_POST   = 1;
    const METHOD_PUT    = 2;
    const METHOD_DELETE = 3;
    
    public function method()
    {
        return constant(
        	'JSCasts_Request::METHOD_' . 
            strtoupper($_SERVER['REQUEST_METHOD'])
        );
    }
    
    public function pathInfo()
    {
        if (empty($_SERVER['PATH_INFO'])) {
            return null;
        }
        else {
            return $_SERVER['PATH_INFO'];
        }
    }
    
    public function data($index)
    {
        return $_REQUEST;
    }
}